package com.dianping.cat.home.dependency.config.transform;
import com.dianping.cat.home.dependency.config.entity.DomainConfig;
import com.dianping.cat.home.dependency.config.entity.EdgeConfig;
import com.dianping.cat.home.dependency.config.entity.NodeConfig;
import com.dianping.cat.home.dependency.config.entity.TopologyGraphConfig;
import java.util.ArrayList;
import java.util.List;

public class DefaultLinker implements ILinker {
  private boolean m_deferrable;

  public DefaultLinker(boolean deferrable) {
/* 13 */     this.m_deferedJobs = new ArrayList();


/* 16 */     this.m_deferrable = deferrable;
  }
  private List<Runnable> m_deferedJobs;
  public void finish() {
/* 20 */     for (Runnable job : this.m_deferedJobs) {
/* 21 */       job.run();
    }
  }


  public boolean onDomainConfig(final NodeConfig parent, final DomainConfig domainConfig) {
/* 27 */     if (this.m_deferrable) {
/* 28 */       this.m_deferedJobs.add(new Runnable()
          {
            public void run() {
/* 31 */               parent.addDomainConfig(domainConfig);
            }
          });
    } else {
/* 35 */       parent.addDomainConfig(domainConfig);
    }

/* 38 */     return true;
  }


  public boolean onEdgeConfig(final TopologyGraphConfig parent, final EdgeConfig edgeConfig) {
/* 43 */     if (this.m_deferrable) {
/* 44 */       this.m_deferedJobs.add(new Runnable()
          {
            public void run() {
/* 47 */               parent.addEdgeConfig(edgeConfig);
            }
          });
    } else {
/* 51 */       parent.addEdgeConfig(edgeConfig);
    }

/* 54 */     return true;
  }


  public boolean onNodeConfig(final TopologyGraphConfig parent, final NodeConfig nodeConfig) {
/* 59 */     if (this.m_deferrable) {
/* 60 */       this.m_deferedJobs.add(new Runnable()
          {
            public void run() {
/* 63 */               parent.addNodeConfig(nodeConfig);
            }
          });
    } else {
/* 67 */       parent.addNodeConfig(nodeConfig);
    }

/* 70 */     return true;
  }
}


/* Location:              /Users/hanfei/Documents/apache-tomcat-9.0.24/webapps/cat/WEB-INF/classes/!/com/dianping/cat/home/dependency/config/transform/DefaultLinker.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       1.0.7
 */